-
-
Notifications
You must be signed in to change notification settings - Fork 269
Add support for pinning snapshots in gradle resolver #1412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
String pomName = String.format("%s-%s.pom", coords.getArtifactId(), coords.getVersion()); | ||
String pom = Paths.get(originalTarget).getParent().resolve(pomName).toString(); | ||
|
||
String pom = coords.setExtension("pom").toRepoPath(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why the special handling of POM files above 🤔
d2b0d98
to
7a13a1d
Compare
"jar": "79abe7953803b20d1deb5f36283d4d640c7aacbdb1ddd7601aae369b1633e903" | ||
}, | ||
"version": "999.0.0-HEAD-jre-SNAPSHOT", | ||
"version_revision": "999.0.0-HEAD-jre-20250623.150948-114" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is how the snapshot version pinning looks like, including the timestamp
Thank you for the PR. I think there's a couple of things that I think about as I read this:
You are correct that some maven repos do write snapshots versions like this, and that's what makes things tricky. I suspect that the correct fix will be to:
What do you think? |
Thanks for the feedback. Let me ask for some more context to understand a bit better your thoughts 😄
By "version", do you mean "timestamp"? If yes, is there maybe a public snapshot you could share that does not have timestamp, that I could use during development and to add tests?
What do you mean here, that snapshots should be handled by all resolvers? If yes, I agree. I was planning to look into the other resolvers after merging this PR. Is that okey, or would you prefer to do it differently?
Let me expand a bit on my comment here. How would this work in bazel?
Integrating snapshots without timestamps goes against bazel fundamentals + it is deprecated from maven 3. This is what makes me question wether this ruleset wants/needs to support it. Wdyt? |
1f1457a
to
e16bd7b
Compare
@shs96c let me know 🙏 |
e16bd7b
to
72ff1e8
Compare
I know this is a long reply, but please know that I'm generally supportive of the idea of allowing snapshots to be used, but I'm very wary about how that support should be added. I'm really happy to work with you to find a solution that works for everyone. @acecilia, an example of where the My other concern is that snapshot servers seldom keep an extensive history of snapshots; they get removed fairly swiftly. In one company I worked for, the lifetime of a snapshot was at most 30 days. Using snapshots necessarily means that we've given up on historical builds of our project. That's not an objection to providing support for them, but it's something we should call out in the docs.
It would be nice if the resolvers all supported snapshots, but the main thing is that we should be able to handle both kinds of snapshots (the ephemeral dated ones and the ones that are being replaced) with similar logic. The only safe way to do that is to set the checksum to
Yes. This is true. Having said that, there are notable rulesets in the bazel world that already omit the shasum check by necessity (for example, when
I believe that Bazel will refetch the resource every time the daemon is started. It should be sufficient to do a
Sadly this isn't the case in the wild. Many OSS projects have ephemeral snapshots that are replaced with each new version, and from experience I know that there are corporate servers that work the same way.
Given that we recently had a request to support java 8, I don't think everyone will migrate to maven 3 in a hurry. If we're going to support snapshots, we need to support all of them. So far, I've never implemented snapshot support for these reasons:
The inability to rely on a build is a real problem for me, but I acknowledge that people who deliberately use snapshots accept this risk, so that's not a blocking issue for me. Of these reasons, I think we have a path forward for the first ("just" don't set the checksum), the second is a quality of life thing users of snapshots will have to accept, and you're making a start on the third. I think we can figure this out :) |
Hi 👋
This PR adds support for snapshot dependencies in the gradle resolver. It uses the repository timestamp of the snapshot as a version. I added this information in a new field with a generic name
VersionRevision
.Related: #974